﻿@model ChurchDiary.TableEntity.EntityLabels
<script src="~/Scripts/SettingsControllers/NotificationController.js"></script>
<div class="row" ng-controller="NotificationController">
    <div class="search-bar collapsed">
        <div class="form-group">
            <div class="input-group input-group-lg">
                <input type="text" class="form-control" placeholder="Type to search..."  ng-model="search" ng-change="filter()" >
                <span class="input-group-btn">
                    <button class="btn btn-square btn-lg btn-default no-shadow close-search-bar" type="button"><i class="zmdi zmdi-close"></i></button>
                </span>
            </div>
        </div>
    </div>
    <div class="col-md-12">
        <div class="bg-white bs-0 mb-20 widget">
            <div role="tabpanel">
                <ul class="nav nav-pills bg-black bs-inset-primary" role="tablist">
                    <li role="presentation" class="pt-15 pb-15 pl-10 pr-20 mb-0">
                        <h3 class="fs-16 lh-1 m-0 text-white text-uppercase">@Html.LabelFor(m => m.FuncationaliyList) <span ng-show="result>0">({{result}}) New Notification found</span> </h3>
                    </li>
                    <li class="pull-right pt-15 pb-15 pl-20 pr-10 fs-20 lh-1 mb-0">
                        <ul class="pull-right list-inline fs-16 lh-1 mb-0">
                            <li><a href="javascript:;" class="text-white" ng-click="Refresh('add','')"><i class="fa fa-refresh"></i></a></li>
                        </ul>
                    </li>
                </ul>
                <div class="tab-content widget-body">
                    <div class="widget-body">
                        <div class="row">
                            <div class="col-md-12">

                                <table class="table table-striped table-bordered">
                                    <thead>
                                        <th>@Html.LabelFor(m => m.ControllerName)&nbsp;<a ng-click="sort_by('list.ControllerName');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                        <th>@Html.LabelFor(m => m.ActionName)&nbsp;<a ng-click="sort_by('list.ActionName');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                        <th>@Html.LabelFor(m => m.ActionDescription)&nbsp;<a ng-click="sort_by('list.ActionDescription');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                        <th>@Html.LabelFor(m => m.NotifcationTemplate)&nbsp;<a ng-click="sort_by('list.NotifcationTemplate');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                        <th>@Html.LabelFor(m => m.Action)&nbsp;</th>
                                    </thead>
                                    <tbody>
                                        <tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
                                            <td>{{data.ControllerName}}</td>
                                            <td>{{data.ActionName}}</td>
                                            <td>{{data.ActionDescription}}</td>
                                            <td>{{data.NotifcationTemplate}}</td>
                                            <td>
                                                <div class="btn-group-sm" role="group" aria-label="Second group">
                                                    <button type="button" class="btn btn-info waves-effect" ng-click="toggle('edit',data.ActionId);"><i class="fa fa-pencil"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="col-md-12" ng-show="filteredItems == 0">
                                <div class="col-md-12" style="text-align: center;">
                                    <h4>@Html.LabelFor(c => c.NoData)</h4>
                                </div>
                            </div>

                        </div>
                        <div ng-show="filteredItems > 0" style="padding-right: 10px; text-align: right;">
                            <div pagination="" page="currentPage" max-size="10" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-panel" tabindex="-1" id="notification" role="dialog" aria-labelledby="myPanelModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header bg-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myAnimationModalLabel">{{title}}</h4>
                </div>
                <form name="fromvalidate" novalidate>
                    <div class="modal-body">
                        <div class="form-group">
                            <input type="hidden" ng-model="notification.ControllerActionsId" />
                            <input type="hidden" ng-model="notification.ActionId" />
                            @Html.LabelFor(m => m.ControllerName)
                            <input type="text" class="form-control" disabled="true" ng-model="notification.ControllerName">
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.ActionName)
                            <input type="text" class="form-control" disabled="true" ng-model="notification.ActionName">
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.ActionDescription)
                            <textarea ng-model="notification.ActionDescription" name="ActionDescription" class="form-control" ng-required="true"></textarea>
                            <p class="error" ng-show="fromvalidate.ActionDescription.$error.required">@Html.LabelFor(m => m.ActionDescription) @Html.LabelFor(m => m.Requried)</p>
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.NotifcationTemplate)
                            <textarea ng-model="notification.NotifcationTemplate" name="NotifcationTemplate" class="form-control" ng-required="true"></textarea>
                            <p class="error" ng-show="fromvalidate.NotifcationTemplate.$error.required">@Html.LabelFor(m => m.NotifcationTemplate) @Html.LabelFor(m => m.Requried)</p>
                        </div>
                        <div class="form-group">
                            <label class="checkbox-inline checkbox-custom mr-15">
                                <input type="checkbox" value="remember" id="exampleCheckboxEmail" ng-model="notification.EmailStatus" checked="{{notification.EmailStatus}}">
                                <label for="exampleCheckboxEmail">@Html.LabelFor(model => model.EmailNotification)</label>
                            </label>
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.Prioty)
                            <select ng-model="notification.Priorty"
                                ng-options="obj.PriorityId as obj.PriorityName for obj in Priority"
                                class="form-control"
                                ng-required="true">
                            </select>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" ng-disabled="fromvalidate.$invalid || requeststatus" ng-click="save(modelstate)">Save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
